<!--JSP初始化设置-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.infomanage.po.*" %>
<%@page import="com.infomanage.vo.*" %>
<%@page import="com.infomanage.enums.*"%>
<%@page import="com.infomanage.service.plan.*"%>
<%  response.addDateHeader("Expires", 0);response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache");%>
<%
    request.setCharacterEncoding("UTF-8");
	String trainId = request.getParameter("trainId");
    if(trainId == null) trainId = "";
    
    EducationtrainPlanItem trainItem = EducationTrainPlanService.loadEducationTrainPlan(request, response, out);
    int persionId = -1;
    int deptId = -1;
    String place = "";
    String way = "";
    int postion = -1;
    String grade = "";
    String beginTime = ""; 
    String endTime = ""; 
    String desc = "";
    String personname = "";
    String deptname = "";
    if(trainItem != null) {
    	EducationtrainPlan train = trainItem.getBean();
		Person person = trainItem.getPerson();
	    persionId = train.getPersonId();
	    personname = person.getName();
	    postion = train.getPosition();
	    place = train.getPlace();
	    way = train.getWay();
	    beginTime = train.getBeginTime();
	    endTime = train.getEndTime();
	    grade = train.getGrade();
	    desc = train.getDescription();
    } 
%>
<html>
<head>
	<title>教育与培训计划</title>
	<link href="../../css/table.css" rel="stylesheet" type="text/css">
	<link href="../../css/calendar.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="../../js/calendar.js"></script>
	<script type="text/javascript" src="../../js/common.js"></script>
	<script type="text/javascript">

		function clickBody() {
			var srcObj = event.srcElement;
			var treeFrame = document.getElementById("treeFrame");
			if(srcObj.treeSelect == "true"){
				
			}else {
				treeFrame.style.display = "none";
			}
		}
		
		function selectNode(id, title){
			currTreeInputObj.value = title;
			currTreeInputObj.nextSibling.value = id;
			var treeFrame = document.getElementById("treeFrame");
			treeFrame.style.display = "none";
    	}
		
		 function init() {
			   if("" != "<%=trainId%>") { // 修改
				   form1.personId.value = "<%=persionId%>";	
				   form1.personname.value = "<%=personname%>";	
				   form1.postion.value = "<%=postion%>";
				   form1.place.value = "<%=place%>";
				   form1.way.value = "<%=way%>";
				   form1.beginTime.value = "<%=beginTime%>";
				   form1.endTime.value = "<%=endTime%>";
				   form1.grade.value = "<%=grade%>";
				   form1.description.value = "<%=desc%>";
			   }
		   }
		   // 提交
		   function doSubmit(){
		   		if(validate()){
		   			return;
		   		}
			 	if("" == "<%=trainId%>") {
			 		form1.actionType.value = "add";
				}else {
			 		form1.actionType.value = "modify";
				}
			 	form1.submit();
		   }
			
		  function validate(){
		   		if(form1.personId.value == ""){
		   			alert("姓名不能为空！");
		   			return true;
		   		}
		   		
		   		if(form1.place.value.length > 100){
	   				alert("培训地点不能超过100个字！");
	   				return true;
	   			}
	   			
		   		if(form1.way.value.length > 100){
	   				alert("培训方式不能超过100个字！");
	   				return true;
	   			}
	   			
		   		if(form1.description.value.length > 5000){
	   				alert("备注不能超过5000个字！");
	   				return true;
	   			}
	   			
		   		return false;
		   }
		   function showError(error){
			   alert(error);
		   }

		   function showInfo(info){
			   alert(info);
			   window.returnValue = "ok";
			   window.close();
		   }
	</script>
</head>
<body  rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" onclick="clickBody();" onload="init();">
	<form name="form1" action="educationTrain_action.jsp" method="post" target="actionFrame">
	<input type="hidden" name="trainId" value="<%=trainId%>">
	<input type="hidden" name="actionType">
	<table class="dialogTable" cellpadding="0" cellspacing="0">
		<!-- 表头-->
		<tr class="dialogTableHeader">
			<td>教育与培训计划</td>
		</tr>
		<!-- 表数据-->
		<tr class="dialogTableContent">
			<td>
				<!-- 数据项 -->
				<table class="dataTable">
					<col width="30%">
					<col width="70%">
					<tr>
						<td class="field">
							姓名
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '../common/personTree.jsp');" treeSelect="true">
								<input name="personname" value="" style="width: 338px;" readonly="readonly" treeSelect="true"><input name="personId" value="" type="hidden">
							</span>
						</td>
					</tr>
					<tr>
						<td class="field">
							职务
						</td>
						<td>
							<select style="width: 100%" name="postion">
							   <%
			                   		for(PositionType type: PositionType.getMembers()){
			                   %>			
			                   		<option value="<%= type.value() %>"><%= type.title()%></option>
			                   <%
			                   		}
			                   %>
							</select>
						</td>
					</tr>
					<tr>
						<td  class="field">
							培训地点
						</td>
						<td>
							<input type="text" style="width: 100%" name="place">
						</td>
					</tr>
					<tr>
						<td class="field">
							培训方式
						</td>
						<td>
							<input type="text" style="width: 100%" name="way">
						</td>
					</tr>
					<tr>
						<td class="field">
							开始时间
						</td>
						<td>
							<input type="text" style="width: 230px;cursor: hand;" id="beginTime" name="beginTime" onClick="return showCalendar(this.id, 'y-mm-dd');" readonly="readonly"><img 
									src="../../img/tip_calender.gif" style="cursor: hand;" width="16" height="16" onClick="return showCalendar('beginTime', 'y-mm-dd');">
						</td>
					</tr>
					<tr>
						<td class="field">
							结束时间
						</td>
						<td>
							<input type="text" style="width: 230px;cursor: hand;" id="endTime" name="endTime" onClick="return showCalendar(this.id, 'y-mm-dd');" readonly="readonly"><img 
									src="../../img/tip_calender.gif" style="cursor: hand;" width="16" height="16" onClick="return showCalendar('endTime', 'y-mm-dd');">
						</td>
					</tr>
					<tr>
						<td class="field">
							培训成绩
						</td>
						<td>
							<input type="text" style="width: 100%" name="grade">
						</td>
					</tr>
					<tr style="height: 100px">
						<td class="field">
							备注
						</td>
						<td valign="top">
							<textarea style="width: 100%;height: 100%" name="description"></textarea>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="tableBtn">
				<span onclick="doSubmit();">确定</span>
				<span onclick="window.close();">取消</span>
			</td>
		</tr>
		<tr valign="top">
			<td colspan="2">
				&nbsp;
			</td>
		</tr>
	</table>
	</form>
	<iframe src="#" frameborder="0" id="treeFrame" name="frame" style="display: none;position: absolute;"></iframe>
	<iframe src="#" name="actionFrame" style="display: none;"></iframe>
</body>
</html>